package com.ai.api.controller;

import com.ai.bo.InterViewerBo;
import com.ai.exception.GraceException;
import com.ai.grace.result.GraceJSONResult;
import com.ai.grace.result.ResponseStatusEnum;
import com.ai.service.InterviewerService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import wst.ai.pojo.interviewer.InterViewer;

import java.util.List;

@RestController
@RequestMapping("interviewer")
public class InterviewerController {
    @Autowired
    private InterviewerService interviewerService;
    @PostMapping("createOrUpdate")
    public GraceJSONResult createOrUpdate(@Valid @RequestBody InterViewerBo interViewerBo){
        interviewerService.createOrUpdate(interViewerBo);
        return GraceJSONResult.ok();
    }

    /**
     * 获取所有面试官
     * @return
     */
    @GetMapping("list")
    public GraceJSONResult list(){
        List<InterViewer> interViewerList = interviewerService.getAllInterviewer();
        return GraceJSONResult.ok(interViewerList);
    }

    @DeleteMapping("delete")
    private Object delete(@RequestParam String interviewerId){
        interviewerService.delete(interviewerId);
        return GraceJSONResult.ok();
    }
}
